package com.shiliao.app.activity.personal.ui;

import android.view.View;

import com.shiliao.app.R;
import com.shiliao.app.activity.personal.presenter.ContributionNumberPresenter;
import com.shiliao.app.activity.personal.view.ContributionNumberView;
import com.shiliao.app.manager.YMUserManager;
import com.shiliao.app.utils.WebSetUtil;
import com.shiliao.app.utils.YMServerUtil;
import com.shiliao.app.weight.ActionBarView;
import com.shiliao.app.weight.ProgressWebView;
import com.yimei.framework.base.ui.BaseActivity;

import butterknife.BindView;

/**
 * Created by yinzhiqiang on 2018/3/28.
 */

public class ContributionNumberActivity extends BaseActivity implements ContributionNumberView {
    @BindView(R.id.webview)
    ProgressWebView webview;

    @BindView(R.id.title_bar)
    ActionBarView mActionBar;
    private ContributionNumberPresenter presenter;

    @Override
    public int getLayoutId() {
        return R.layout.activity_contribution_number;
    }

    @Override
    public void initView() {
        super.initView();
        mActionBar.setTitles("我的贡献点");
        mActionBar.setBackClick(this);
        mActionBar.getBackView().setVisibility(View.VISIBLE);
        presenter = new ContributionNumberPresenter(this);
        String userId = YMUserManager.getUserId(this);
        presenter.request(userId);
        WebSetUtil.setWebView(webview);
    }


    @Override
    public void getTextContent(final String content) {
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                webview.loadDataWithBaseURL(YMServerUtil.BASE_URL,
                        content, "text/html", "utf-8", null);
            }
        });
    }
}
